package com.hzit.security.controller;

import com.hzit.security.entity.User;
import com.hzit.security.service.IUserService;
import com.hzit.security.vo.UserVo;
import com.hzit.util.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/user")
public class UserController {
	@Autowired
	private IUserService userService;
	@PostMapping("/login")
	public R login(@RequestBody UserVo vo){
		return R.ok();
	}

	@GetMapping("/list")
	@PreAuthorize("hasAuthority('user:touserlistxxx')")
	public R list(){
		List<User> users = userService.list();
		return R.ok(users);
	}
}
